﻿Imports System.Data.SqlClient
Imports System.Net
Imports prjTheoDoiHoSo
Imports DMC.Database


Public Class frmCanhBaoHoSoChuXuLy
    Private strConnection As String = ""
    Dim dthosoguilenquan As New DataTable
    Public Property Connection() As String
        Get
            Return strConnection
        End Get
        Set(ByVal value As String)
            strConnection = value
        End Set
    End Property
    Private Sub btnDong_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDong.Click
        Me.Close()
    End Sub
    Private Function layThongTinCanhBao() As String
        Dim cls As New classtheodoi
        cls.Connection = Connection
        Dim parasHoSoGui() As String = {"@MaDonViHanhChinh", "@Flag", "@ToBanDo", "@SoThua", "@DiaChi"}
        Dim ValuesHoSoGui() As String = {User.DonViHanhChinhHienThoi, "1", "", "", ""}
        dthosoguilenquan.Clear()
        dthosoguilenquan = cls.GetData_SP("SPLoadHoSoPhuongQuan", parasHoSoGui, ValuesHoSoGui)
        Dim str As String = ""
        str = "Có " & dthosoguilenquan.Rows.Count.ToString & " hồ sơ đang chờ xử lý"
        Return str
    End Function
    Private Function layHoSoChuaXuLy() As DataTable       
        Dim para() As String = {"@MaUser"}
        Dim value() As String = {User.MaUser.ToString}
        Dim dt As New DataTable
        Dim cls As New clsDatabase
        cls.Connection = GetConnection(True)
        cls.OpenConnection()
        cls.getValue(dt, "ThongKeHoSoChuaXuLy", para, value)
        Return dt
    End Function
    Private Sub frmCanhBaoHoSoChuXuLy_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Me.Connection = GetConnection(True)
        'Dim connect As SqlConnection = New SqlConnection(strConnection)
        'connect.Open()
        'Dim sql As String = "select  a.Ten as TenPhuong,count(b.guidi) as SoBanGhi " & _
        '"from tblTuDienDonViHanhChinh a left join tblHoSoChuyenGiuaPhuongVaQuan b on a.MaDonViHanhChinh=b.MaDonViHanhChinh" & _
        '" where a.MaXa <> 0 and guidi=1 group by b.guidi, a.Ten order by SoBanGhi DESC "
        'Dim cmd As SqlCommand = New SqlCommand(sql, connect)
        'Dim datatable As DataTable = New DataTable()
        'Dim apdapter As SqlDataAdapter = New SqlDataAdapter(cmd)
        'apdapter.Fill(datatable)
        'dgvHoSoChuaXuLy.DataSource = datatable
        dgvHoSoChuaXuLy.DataSource = layHoSoChuaXuLy()
    End Sub
    'Public Function getname(ByVal str As String) As String
    '    Me.Connection = GetConnection(True)
    '    Dim connect As SqlConnection = New SqlConnection(strConnection)
    '    connect.Open()
    '    Dim sql As String = "select Ten from tbltudiendonvihanhchinh where MaDonViHanhChinh=" & str
    '    Dim cmd As SqlCommand = New SqlCommand(sql, connect)
    '    Dim datatable As DataTable = New DataTable()
    '    Dim apdapter As SqlDataAdapter = New SqlDataAdapter(cmd)
    '    apdapter.Fill(datatable)
    '    Return datatable.Rows(0)("Ten").ToString
    'End Function
End Class